%rebase base/layout title="Ivan's Blog 编辑文章"
<div style="background: url(/images/img02.gif) repeat-x left top;padding-top: 20px;">
	<h4>编辑文章</h4>
	%if error:
	<div class="error">{{error}}</div>
	%end
	<form action="/updatearticle" method="post" name="editarticleForm">
	<input type="hidden" name="id" value="{{data['id']}}"/>
	<table cellpadding="5" cellspacing="0" width="100%">
		<tr>
			<td><label for="subject">标题(<span style="color:#f00;">必须</span>)</label></td><td><input type="text" name="subject" id="subject" value="{{data['subject']}}" size="50"/></td>
		</tr>
		<tr>
			<td valign="top"><label for="tags">标签</label></td>
			<td>
				<input type="text" name="tags" id="tags" value="{{data['tags']}}" size="50" class="inputcls"/>
			</td>
		</tr>
		<tr>
			<td><label for="category_id">类别(<span style="color:#f00;">必须</span>)</label></td>
			<td>
				<select id="category_id" name="category_id">
					<option value="">---请选择---</option>
					%for t in categories: 
						%if str(data['category_id']) == str(t.id):
						<option value="{{t.id}}" selected="selected">{{t.cate_name}}</option>
						%else:
						<option value="{{t.id}}">{{t.cate_name}}</option>
						%end 
					%end
				</select>
			</td>
		</tr>
		<tr>
			<td valign="top"><label for="shortness_content">简略(<span style="color:#f00;">必须</span>)</label></td>
			<td>
				<textarea name="shortness_content" id="shortness_content" style="width: 600px;height: 150px;">{{data['shortness_content']}}</textarea>
			</td>
		</tr>
		<tr>
			<td valign="top"><label for="full_content">全文(<span style="color:#f00;">必须</span>)</label></td>
			<td>
				<textarea name="full_content" id="full_content" style="width: 600px;height: 300px;">{{data['full_content']}}</textarea>
			</td>
		</tr>
		<tr>
			<td>&nbsp;</td><td><input type="submit" value="保存" class="btncls"/>&nbsp;&nbsp;<input type="button" value="返回" onclick="javascript:history.go(-1)" class="btncls"/></td>
		</tr>
	</table>
	</form>
</div>
<style>
<!--
.btnCode {
	background:transparent url(/xheditor/xheditor_skin/default/img/code.gif) no-repeat 16px 16px;
	background-position:2px 2px;
}
-->
</style>
<script type="text/javascript" src="/scripts/jquery-1.4.2.pack.js"></script>
<script type="text/javascript" src="/xheditor/xheditor-zh-cn.min.js"></script>
<script type="text/javascript" src="/xheditor/ubb.js"></script>
<script type="text/javascript">
	var plugins = {
		Code:{c:'btnCode',t:'插入代码',h:1,e:function(){
			var _this=this;
			var htmlCode='<div><select id="xheCodeType"><option value="html">HTML/XML</option><option value="javascript">JavaScript</option><option value="css">CSS</option><option value="php">PHP</option><option value="csharp">C#</option><option value="cpp">C++</option><option value="java">Java</option><option value="python">Python</option><option value="ruby">Ruby</option><option value="sql">SQL</option><option value="plain">其它</option></select></div><div><textarea id="xheCodeValue" wrap="soft" spellcheck="false" style="width:300px;height:100px;" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="确定" /></div>';			
			var jCode=$(htmlCode),jType=$('#xheCodeType',jCode),jValue=$('#xheCodeValue',jCode),jSave=$('#xheSave',jCode);
			jSave.click(function(){
				_this.loadBookmark();
				_this.pasteText('[code='+jType.val()+']\r\n'+jValue.val()+'\r\n[/code]');
				_this.hidePanel();
				return false;	
			});
			_this.showDialog(jCode);
		}}
	};
	$('#full_content').xheditor({
		forcePtag:false,emotMark:true,urlType:'root',plugins:plugins,beforeSetSource:ubb2html,beforeGetSource:html2ubb,showBlocktag:false
	});
	$('#shortness_content').xheditor({
		forcePtag:false,emotMark:true,urlType:'root',plugins:plugins,beforeSetSource:ubb2html,beforeGetSource:html2ubb,showBlocktag:false
	});
</script>